<template>
  <view class="content">
    <view class="payType" @click="handleMethods(0)">
      <view class="payType_title">充值提现</view>
      <image
        src="/static/jiantou.png"
        class="payType_arrow"
        mode="scaleToFill"
      ></image>
    </view>

    <view class="payType" @click="handleMethods(1)">
      <view class="payType_title">转账</view>
      <image
        src="/static/jiantou.png"
        class="payType_arrow"
        mode="scaleToFill"
      ></image>
    </view>
  </view>
</template>

<script>
import api from "@/api/api.js";
import tip from "@/utils/tip.js";
export default {
  data() {
    return {
      userInfo: "",
      shande_wallet_url: "",
    };
  },
  onShow() {
    this.getWalletUrl();
    this.userInfo = uni.getStorageSync("userInfo");
  },
  methods: {
    async getWalletUrl() {
      let res = await api.getWalletUrl({
        method: "get",
        query: {},
      });

      if (res.code == 0) {
        this.shande_wallet_url = res.data;
      } else {
        tip.defaults(res.msg);
      }
    },
    async handleMethods(index) {
      if (index == 0) {
        // #ifdef H5
        if (this.shande_wallet_url) {
          window.location.href = this.shande_wallet_url;
        }
        // #endif
        // #ifdef APP-PLUS
        if (this.shande_wallet_url) {
          plus.runtime.openURL(this.shande_wallet_url);
        }
        // #endif
        return;
      } else if (index == 1) {
        uni.navigateTo({
          url: "../shandeWallet/shandeTransfer",
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  width: 750rpx;
  padding: 0 30rpx;
}
.payType {
  display: flex;
  align-items: center;
  position: relative;
  width: 690rpx;
  height: 150rpx;

  background-image: url("/static/fastPay_bg.png");
  background-repeat: no-repeat;
  background-size: 100%;
  .payType_image {
    position: absolute;
    top: 30rpx;
    left: 30rpx;
    width: 90rpx;
    height: 90rpx;
  }
  .payType_title {
    // margin-left: 140rpx;
    margin-left: 30rpx;
    width: 160rpx;
    height: 56rpx;
    // font-size: 40rpx;
    font-size: 34rpx;
    font-weight: 400;
    color: #ffffff;
    line-height: 56rpx;
  }
  .payType_state {
    margin-left: 220rpx;
    width: 160rpx;
    height: 56rpx;
    font-size: 26rpx;
    font-weight: 400;
    color: #ffffff;
    line-height: 56rpx;
  }
  .payType_arrow {
    position: absolute;
    top: 62rpx;
    right: 30rpx;
    width: 28rpx;
    height: 28rpx;
  }
}
.payType + .payType {
  margin-top: 30rpx;
}
</style>